#include "trackthread.h"

TrackThread::TrackThread(Track *aTrack, GPS* aReceiver) :
    myTrack(aTrack), myReceiver(aReceiver), stopped(false)
{}

TrackThread::~TrackThread()
{}

void TrackThread::stop(void)
{
    stopped = true;
}

void TrackThread::run()
{
    if(myTrack && myReceiver)
        while(!stopped)
        {
            GeoCoordinates tmpCoord;
            if(myReceiver->GetCoordinates(tmpCoord))
            {
                myTrack->AddPoint(QDateTime::currentDateTime(), tmpCoord);
                sleep(10);
            }
        }
}
